package com.ymtms.settlement.service.impl;

import com.ymtms.settlement.dao.CollectionBusinessParametersMapper;
import com.ymtms.settlement.pojo.CollectionBusinessParameters;
import com.ymtms.settlement.service.CollectionBusinessParametersService;
import com.ymtms.settlement.vo.GridResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CollectionBusinessParametersServiceImpl implements CollectionBusinessParametersService {
    @Autowired
    CollectionBusinessParametersMapper collectionBusinessParametersMapper;

   /* @Override


    @Override
    public void update(CollectionBusinessParameters collectionBusinessParameters) {
        int result = collectionBusinessParametersMapper.updateInfo(collectionBusinessParameters);
        if(result==0){
            throw new RuntimeException("未找到对应数据！");
        }
    }

    @Override
    public void save(CollectionBusinessParameters collectionBusinessParameters) {
        int result = collectionBusinessParametersMapper.insertCbp(collectionBusinessParameters);
        if(result==0){
            throw new RuntimeException("新增失败！");
        }
    }

    @Override
    public void removeByCbpid(Integer Cbpid) {
        int result = collectionBusinessParametersMapper.deleteByCbpid(Cbpid);
        if(result==0){
            throw new RuntimeException("删除失败！");
        }
    }

    @Override
    public void updateStatusByCbpid(Integer cbpid, Integer status) {
        int result = collectionBusinessParametersMapper.updateStatusByCbpid(cbpid, status);
        if(result==0){
            throw new RuntimeException("操作失败！");
        }
    }*/
   public GridResult<CollectionBusinessParameters> queryAllCbp() {
       List<CollectionBusinessParameters> result = collectionBusinessParametersMapper.selectAllCbp();
       // 新建一个封装类对象，设置参数，传入查询得到的数据
       GridResult<CollectionBusinessParameters> grid = new GridResult<>();
       // 存入查询数据
       grid.setData(result);
       return grid;
   }
}
